#ifndef CE_GFX_IMAGE_H
#define CE_GFX_IMAGE_H

#include <export.h>
#include <asset/asset.h>
#include <gfx/enum.h>
#include <iobject.h>
#include <vector>

/**
 * \addtogroup graphics
 * @{
 */

/**
 * @brief Implemenation of an image in CPU memory.
 */
class CE_API ceImage : public ceAsset
{
  CE_ASSET_ID3('i', 'm', 'g')
  CE_OBJECT
public:
  struct Description
  {
    unsigned    width;
    unsigned    height;
    cePixelFormat format;
  };

private:
  struct Layer
  {
    Description     Desc;
    unsigned char*  Data;
  };

  std::vector<Layer>    _layers;
  unsigned              _currentLayer;


public:
  ceImage();
  ~ceImage ();

  void Clear (unsigned layer = 0);
  bool Initialize (const Description& desc, const void* data);

  void SetCurrentLayer (unsigned layer);
  unsigned GetCurrentLayer ();
  unsigned GetNumberOfLayers ();

  void* GetData ();
  const void* GetData () const;
  const cePixelFormat& GetFormat () const;
  unsigned GetWidth () const;
  unsigned GetHeight () const;
  unsigned GetRGB (unsigned x, unsigned y) const;

  void GenerateMipMaps ();

};

/** @} */
#endif // CE_GFX_IMAGE_H
